/*********************************************************************
 *
 *  elksip - a multi-platform Sip Phone Server
 *
 *  file: sip_core.c  sip core
 *
 *  Copyright 2011-2012 Elksip.
 *
 ********************************************************************/

#include <string.h>
#include "sip_inc.h"
#include "sip_core.h"
#include "sip_debug.h"

extern char *elk_version;

static SipCore sipCore;

static char SipServerAgent[64] = "Server: ElkSIP  (0.5.1-(i386/linux))";
int SipCoreInit(void)
{
    elk_log_init();
    memset(&sipCore, 0, sizeof(SipCore));
    sipCore.reg_period = SIP_REG_PERIOD;
    sipCore.UserAgent = strdup("zhang/0.5.2");
    sipCore.Max_Forwards = 70;
    sipCore.realm = strdup("elksip");  

    snprintf(SipServerAgent, sizeof(SipServerAgent), "Server: ElkSIP  (%s-(i386/linux))", elk_version);

    elk_log(LOG_INFO, "SipCoreInit finished!");
    return 0;
}

const char * get_version(void)
{   
    return SipServerAgent;
}

int SipCoreUnInit(void)
{
	free(sipCore.UserAgent);
	free(sipCore.realm);
    elk_log_close();
	return 0;
}
